package net.wavorizer.model;

import net.wavorizer.util.Utils;

import javax.jdo.annotations.*;
import java.util.Date;
import java.util.List;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class BotTransaction
{
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;

    @Persistent
    private Date transactionDate;

    @Persistent
    private String waveId;

    @Persistent
    private String waveletId;

    @Persistent
    private String data;

    @Persistent
    private String linkBody;

    @Persistent
    private String createdBy;

    @Persistent
    private List<String> participants;

    public Long getId() {
        return id;
    }

    public Date getTransactionDate() {
        return transactionDate;
    }

    public void setTransactionDate(Date transactionDate) {
        this.transactionDate = transactionDate;
    }

    public String getWaveId() {
        return Utils.remNull(waveId);
    }

    public void setWaveId(String waveId) {
        this.waveId = waveId;
    }

    public String getWaveletId() {
        return Utils.remNull(waveletId);
    }

    public void setWaveletId(String waveletId) {
        this.waveletId = waveletId;
    }

    public String getData() {
        return Utils.remNull(data);
    }

    public void setData(String data) {
        this.data = Utils.remNull(data).length() > 500 ? data.substring(0, 500) : data;
    }

    public String getLinkBody() {
        return Utils.remNull(linkBody);
    }

    public void setLinkBody(String linkBody) {
        this.linkBody = linkBody;
    }

    public String getCreatedBy() {
        return Utils.remNull(createdBy);
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public List<String> getParticipants() {
        return participants;
    }

    public void setParticipants(List<String> participants) {
        this.participants = participants;
    }
}
